package com.atguigu.flink.datastreamapi.transform;

import org.apache.flink.api.common.functions.FilterFunction;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * Created by Smexy on 2022/12/13
 */
public class Demo3_Filter
{
    public static void main(String[] args) throws Exception {

        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        env.setParallelism(1);


        DataStreamSource<Integer> streamSource = env.fromElements(1, 2, 3, 4, 5, 6, 7);

        //只留下返回true的元素
        streamSource.filter(v -> v % 2 == 0).print();

        env.execute();

    }
}
